package com.cjm.one.goods.client;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cjm.one.common.constant.ServerConstants;
import com.cjm.one.common.result.Result;
import com.cjm.one.model.goods.dto.GoodsCommentDto;
import com.cjm.one.model.goods.entity.GoodsComment;
import com.cjm.one.model.goods.entity.GoodsCommentTag;
import com.cjm.one.model.goods.vo.GoodsCommentCountVo;
import com.cjm.one.model.goods.vo.GoodsCommentTagVo;
import com.cjm.one.model.goods.vo.GoodsCommentVo;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = ServerConstants.SERVER_ONE_GOODS)
public interface GoodsCommentClient {
    @GetMapping("/admin/goods/comment/list")
    @Operation(summary = "查询商品评论列表")
    Result<Page<GoodsComment>> list(@RequestParam(name = "current") Long current,
                                           @RequestParam(name = "size") Long size,
                                           @RequestParam(name = "text",required = false) String text,
                                           @RequestParam(name = "userId", required = false) Long userId,
                                           @RequestParam(name = "goodsId", required = false) Long goodsId);
    @GetMapping("/admin/goods/comment/{id}")
    @Operation(summary = "根据id查询商品评论")
    Result<GoodsCommentVo> get(@PathVariable(name = "id") Long id);

    @DeleteMapping("/admin/goods/comment/{id}")
    @Operation(summary = "根据id删除商品评论")
    Result<Boolean> delete(@PathVariable(name = "id") Long id);

    @GetMapping("/app/goods/comment/list")
    @Operation(summary = "商品评论列表")
    Result<Page<GoodsCommentVo>> list(
            @RequestParam(value = "current", defaultValue = "1") Integer current,
            @RequestParam(value = "size", defaultValue = "10") Integer size,
            @RequestParam(value = "goodsId") Long goodsId,
            @RequestParam(value = "sortOrder", required = false) String sortOrder,
            @RequestParam(value = "tagIds", required = false) List<Long> tagIds) ;
    @GetMapping("/app/goods/comment/getTagById")
    @Operation(summary = "根据商品id获取商品评论的标签")
    Result<GoodsCommentCountVo> getTagById(@RequestParam("id") Long id);

    @GetMapping("/app/goods/comment/top3")
    @Operation(summary = "获取热门前三评论")
    Result<List<GoodsComment>> getTopComments(@RequestParam(value = "goodsId") Long goodsId);

    @GetMapping("/app/goods/comment/tags")
    @Operation(summary = "获取所有评论标签")
    Result<List<GoodsCommentTag>> getTags();
    @PostMapping("/app/goods/comment/save")
    @Operation(summary = "保存商品评论")
    Result<Boolean> save(@RequestBody List<GoodsCommentDto> goodsCommentDto);
}
